home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 422_02 / dosutil / anyfile.c < prev    next >
C/C++ Source or Header  |  1994-03-20  |  714b  |  26 lines

  1. /*
  2.  * Here is a very simple MICRO-C program which takes as arguments a list
  3.  * of filenames (which must be UPPERCASE), and exits with an ERROR CODE
  4.  * of -1 (255) if any files exist in the current directory which are not
  5.  * in that list. This compiles to a < 700 byte COM file.
  6.  *
  7.  * Compile with: cc anyfile -o
  8.  */
  9. main(argc, argv)
  10.     int argc;
  11.     char *argv[];
  12. {
  13.     int i, j;
  14.     char filename[13];
  15.  
  16.     if(!find_first("*.*", 0, filename, &j, &j, &j, &j, &j))
  17.         do {
  18.             for(i=1; i < argc; ++i)
  19.                 if(!strcmp(argv[i], filename))
  20.                     break;
  21.             if(i >= argc)
  22.                 exit(-1); }
  23.         while(find_next(filename, &j, &j, &j, &j, &j));
  24. /* Note: Falling out the bottom causes MICRO-C to return ERROR CODE=0 */
  25. }
  26.